package com.stone.persistent.recyclerview.fragment;

import android.os.Bundle;
import android.view.View;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.stone.persistent.recyclerview.R;
import com.stone.persistent.recyclerview.adapter.MenuGridAdapter;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.HashMap;


public class MenuGridFragment extends Fragment {
    private int page;
    private HashMap findViewCache;

    public final int getPage() {
        return this.page;
    }

    public final void setPage(int var1) {
        this.page = var1;
    }

    public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        RecyclerView mRecyclerView = (RecyclerView) this.findCachedViewById(R.id.menu_recyclerview);
        mRecyclerView.setLayoutManager((new GridLayoutManager(this.getActivity(), 5)));
        mRecyclerView = (RecyclerView) this.findCachedViewById(R.id.menu_recyclerview);
        mRecyclerView.setAdapter(new MenuGridAdapter(this.getActivity(), 0));
    }

    public MenuGridFragment() {
        super(R.layout.fragment_menu_grid);
    }

    public View findCachedViewById(int var1) {
        if (this.findViewCache == null) {
            this.findViewCache = new HashMap();
        }

        View var2 = (View) this.findViewCache.get(var1);
        if (var2 == null) {
            View var10000 = this.getView();
            if (var10000 == null) {
                return null;
            }

            var2 = var10000.findViewById(var1);
            this.findViewCache.put(var1, var2);
        }

        return var2;
    }

    public void clearFindViewByIdCache() {
        if (this.findViewCache != null) {
            this.findViewCache.clear();
        }

    }

    // $FF: synthetic method
    public void onDestroyView() {
        super.onDestroyView();
        this.clearFindViewByIdCache();
    }
}
